package com.kuang.boot.controller;

import com.kuang.boot.dao.EmployeeDao;
import com.kuang.boot.pojo.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Collection;

@Controller
public class EmployeeController {
@Autowired
EmployeeDao employeeDao;

@RequestMapping("/emps")
public String list(Model model){
    Collection<Employee> collection = employeeDao.getAll();
    model.addAttribute("emps",collection);
    return "emps/list";

}
@GetMapping("/emp")
public String addpage(){
    return "emp/add";
}

}
